<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/inc/common.jsp"%>
<html>
<head>
<title>部门管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript">

	function saveDate(){
		var state = $("#state").combobox('getValue');
		var actionUrl = "${basePath}/business/department/save.do";
		$('#ff').form('submit',{   
		     url:actionUrl,
		     onSubmit: function(){
		 		if(state == ""){
		 			$.messager.alert('消息', "请选择状态!");
		 			return false;
		 		}
		    	return $(this).form('validate');
		     },
		     success: function(msg){
		    	if(msg == "success"){
	            	window.location.href="${basePath}/business/department/index.do";
	           	}else if(msg == "repeat"){
	            	$.messager.alert('消息', "已经存在该条数据,请重新修改后保存!");
	            }else{
	            	$.messager.alert('消息', "系统异常,请联系管理员!");
	            }
		     }
		 });
	}
	
	function doBack(){
		window.location.href='department_list.jsp';
	}
</script>
</head>
<body class="easyui-layout">
	<div data-options="region:'center',title:'',footer:'#searchfooter'" >
		<div class="easyui-panel" data-options="fit:true,collapsible:true,title:'部门信息'"  style="padding:10px 10px 10px 10px;">
	    <form id="ff"  method="post">
	    	<input type="hidden" id="id" name="id" value="${department.id}" />
	    	<table  style="width:100%;" cellpadding="0" cellspacing="1"  class="formtablecol1">
	    		<tr>
	    			<td  align="right" style="width: 20%">中文名称:</td>
	    			<td class="value">
		    			<input class="easyui-textbox" type="text" name="name" value="${department.name}" data-options="required:true"></input>
	    			</td>
	    		</tr>
	    		<tr>
	    			<td  align="right">英文名称:</td>
	    			<td class="value">
		    			<input class="easyui-textbox" type="text" name="engName" value="${department.engName}"></input>
	    			</td>
	    		</tr>
	    		<tr>	
	    			<td  align="right">联系人:</td>
	    			<td class="value">
	    				<input name="contacts" id="contacts" class="easyui-textbox" data-options="min:1,max:99" value="${department.contacts}" data-options="required:true"></input>
	    			</td>
	    		</tr>
	    		<tr>
	    			<td  align="right">联系电话:</td>
	    			<td class="value">
	    				<input class="easyui-numberbox" type="text" name="phone" value="${department.phone}" data-options="required:true"></input>
	    			</td>
	    		</tr>
	    		<tr>
	    			<td  align="right">是否为旅行社:</td>
	    			<td class="value">
	    				<input class="easyui-combobox" id="travelFlg" name="travelFlg" value="${department.travelFlg}" data-options="url:'<%=path%>/sys/dictionary/dicbykey.do?key=1012',method:'get',valueField:'dataCode',textField:'dataName',panelHeight:'auto',editable:false,required:true">
	    			</td>
	    		</tr>
	    		<tr>
	    			<td  align="right">描述:</td>
	    			<td class="value">
	    				<input id="description" name="description" class="easyui-textbox" value="${department.description}" data-options="multiline:true" data-options="validType:'maxLength[150]'" style="height: 60px;"></input>
	    			</td>
	    		</tr>
	    		<tr>
	    			<td  align="right">状态:</td>
	    			<td class="value">
	    				<input class="easyui-combobox" id="state" name="state" value="${department.state}" data-options="url:'<%=path%>/sys/dictionary/dicbykey.do?key=1001',method:'get',valueField:'dataCode',textField:'dataName',panelHeight:'auto',editable:false,required:true">
	    			</td>
	    		</tr>
	    	</table>
	    </form>
	</div>
	</div>
	<!-- 保存按钮 -->
	<div id="searchfooter" style="text-align:right;padding: 0px 10px">
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="saveDate()"  data-options="iconCls:'icon-page_save',plain:true" >保存</a>
		<span class="search-btn-separator"></span>
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="doBack()" data-options="iconCls:'icon-undo',plain:true">返回</a>
	</div>
</body>
</html>
